﻿using System;
namespace TerryDong.Data
{
    interface IDataContext<T>
    {
        //add
        void AddModel(T model);
        void AddModel(T model, System.Collections.Generic.List<string> identityColumns);
        
        //delete
        void DeleteModels(string whereCondition);
        void Truncate();
        
        //get
        System.Data.DataTable GetDataTable(string whereCondition);
        System.Data.DataTable GetDataTable(string whereCondition, string orderBy, int pageSize, int pageNumber);
        T GetModelByPrimaryKey(string primaryKey, T model);
        T GetModelByPrimaryKey(string primaryKey, T model, string[] toSelectedColumns);
        System.Collections.Generic.IList<T> GetModels(string[] toSelectedColumns, string whereCondition);
        System.Collections.Generic.IList<T> GetModels(string whereCondition);
        System.Collections.Generic.IList<T> GetModels(string whereCondition, string orderBy, int pageSize, int pageNumber);

        //update
        void UpdateModelByPrimaryKey(string primaryKey, T model, System.Collections.Generic.List<string> identityColumns);
        void UpdateModelByPrimaryKey(string primaryKey, T model);
        void UpdateModels(T model, string whereCondition);
        void UpdateModels(T model, string whereCondition, System.Collections.Generic.List<string> identityColumns);
    }
}
